<template>
  <div style="padding-bottom: 50px;">
    <img class="user-poster"
         src="https://img.yzcdn.cn/public_files/2017/10/23/8690bb321356070e0b8c4404d087f8fd.png"
         alt="">
    <van-row class="user-links">
      <van-col span="6">
        <van-icon name="pending-payment"></van-icon>
        待付款
      </van-col>
      <van-col span="6">
        <van-icon name="pending-orders"></van-icon>
        待接单
      </van-col>
      <van-col span="6">
        <van-icon name="pending-deliver"></van-icon>
        待发货
      </van-col>
      <van-col span="6">
        <van-icon name="logistics"></van-icon>
        待发货
      </van-col>
    </van-row>

    <van-cell-group class="user-group">
      <van-cell icon="records" title="全部订单" to="/OrderList" is-link></van-cell>
    </van-cell-group>

    <van-cell-group>
      <van-cell icon="exchange" title="我的积分" is-link></van-cell>
      <van-cell icon="gold-coin" title="我的优惠券" is-link></van-cell>
      <van-cell icon="gift" title="我收到的礼物" is-link></van-cell>
    </van-cell-group>

    <van-cell-group>
      <van-cell icon="share" title="清空购物车" is-link @click="clearCart"></van-cell>
      <van-cell icon="share" title="清空缓存" is-link @click="clearCache"></van-cell>
      <van-cell icon="close" title="退出登录" is-link @click="exit"></van-cell>
    </van-cell-group>

    <FooterNav></FooterNav>
  </div>
</template>

<script>
  import {Row, Col, Icon, Cell, CellGroup, Toast, Notify} from 'vant';
  import FooterNav from "./Common/FooterNav"
  import platformType from "../assets/app/type/PlatformType"

  import appFunc from "../assets/app/func"

  export default {
    components: {FooterNav},
    created: function () {
      appFunc.login();
      appFunc.isLogin()
    },
    methods: {
      exit: function () {
        appFunc.clearUserInfoCache();
        appFunc.clearCart();
        appFunc.clearAddess();
        appFunc.setActiveNav(0);
        appFunc.clearPlatForm(platformType.MAGAPPX);
        window.location.reload()
      },
      clearCache: function () {
        appFunc.clearCart();
        console.log("clear");
        Notify("操作成功");
      },
      clearCart: function () {
        appFunc.clearCart();
        Notify("操作成功")
      }
    }
  };
</script>
<style>
  .user-poster {
    width: 100%;
    display: block;
  }

  .user-links {
    padding: 15px 0;
    font-size: 12px;
    text-align: center;
    background-color: #fff;
  }

  .van-icon {
    display: block;
    font-size: 24px;
  }
</style>
